package com.liuwei.service;

import javax.annotation.Resource;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.domain.Sort.Order;
import org.springframework.stereotype.Service;

import com.liuwei.dao.RpTransactionMessageDao;
import com.liuwei.model.RpTransactionMessage;

@Service
public class RpTransactionMessageService {
	@Resource
	private RpTransactionMessageDao messageDao;

	public RpTransactionMessage save(RpTransactionMessage r) {
		RpTransactionMessage save = messageDao.save(r);
		return save;
	}
	public Page<RpTransactionMessage> findAll() {
		
		Pageable pageable = new PageRequest(0, 20, new Sort(new Order(Direction.DESC, "id")));
		Page<RpTransactionMessage> result = messageDao.findAll(pageable);
		return result;
	}
}
